﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Agresso.Interface.Layer.SQL
{
    public class AlertSQL
    {
        public static string InsertAlert()
        {
            return @"INSERT INTO i_alert
           ([alert_type]
           ,[alert_description]
           ,[alert_status]
           ,[alert_date]
           ,[alert_modified_date]
            ,[alert_key], entity)
     VALUES
           (@alert_type
           ,@alert_description
           ,@alert_status
           ,@alert_date
           ,@alert_modified_date
           ,@alert_key,@entity)";
        }
        public static string UpdateAlertStatus()
        {
            return @"UPDATE i_alert
   SET [alert_status] = @alert_status      
      ,[alert_modified_date] = @alert_modified_date
        ,entity = @entity
,alert_description= @alert_description
 WHERE alert_key = @alert_key";
        }
        public static string FindAlertByKey()
        {
            return @"select * from i_alert where alert_key = @alert_key";
        }
        public static string FindAlertByKeyAndAlertType()
        {
            return @"select * from i_alert where alert_key = @alert_key and alert_type=@alert_type";
        }
        public static string FindAlertByAlertTypeAndStatus()
        {
            return @"select * from i_alert where alert_status = @alert_status and alert_type=@alert_type";
        }
        public static string FindAlertByAlertTypeAndStatusAndSearch(string search)
        {
            return @"select * from i_alert where alert_status = @alert_status and alert_type=@alert_type
                and CAST(alert_description AS VARCHAR(100))+  CAST(alert_key AS VARCHAR(50)) +  CAST(entity AS VARCHAR(50)) like '%" + search + "%'";
        }
    }
}
